package java_persistence;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import domain.Patient;

/**
 * @author joseph simoneau <simoneau@gatech.edu>
 *
 */
public interface PatientMapper {


	// CREATES

	/**Stores a patient's worth of information in that database.  Note that username must already be associated with a user that is stored in the database and it must be identical.
	 * @param u the username
	 * @param p the pharmacy
	 * @param ii insurance information 
	 * @param al allergy information 
	 * @param im a boolean that is true if the patient is male, false otherwise
	 * @param bd the birthdate of the patient with the format "YYYY-MM-DD"
	 */
	public void create_patient(@Param("username") String u, @Param("pharmacy") String p,@Param("insurance_info") String ii, @Param("allergies") String al, @Param("is_male") Boolean im, @Param("birthdate") String bd);  
	
	// RETRIEVES
	
	/**Retrieves a patient from the database by his/her username
	 * @param username the username
	 * @return a fully-populated patient object including user information 
	 */
	public Patient get_patient_by_username(String username);
	
	/**Retrieves all patients from the database 
	 * @return a List of Patients including associated user information
	 */
	public List<Patient> get_patients();
	
	// UPDATES
	
	/**Updates a patient's details in the database.  Note that this only updates patient information not user information and that this method cannot be used to change a username.
	 * @param u the username of the patient to update
	 * @param p the new pharmacy information
	 * @param ii the new insurnace information
	 * @param al the new allergy information
	 * @param im the new sex boolean, true for male, false otherwise.
	 * @param bd the new birthdate as a string with the format "YYYY-MM-DD"
	 */
	public void update_patient(@Param("username") String u, @Param("pharmacy") String p,@Param("insurance_info") String ii, @Param("allergies") String al, @Param("is_male") Boolean im, @Param("birthdate") String bd);  
	
	// DELETES
	
	/**deletes a users's patient information but does not delete the user.
	 * 
	 *	Note that deleting medical records is unwise and often illegal.  This method is provided primarily for testing purposes. 
	 * 
	 * @param u the username of the patient to delete.
	 */
	public void delete_patient(@Param("username") String u);
	

}
